package com.zzr.demo.redis.scheduled;

import com.zzr.demo.redis.service.BlockMQService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @author: xiaomi
 * @date: 2021/10/8
 * @description:
 */
@Slf4j
@Component
public class GetMessageScheduled {

    @Autowired
    BlockMQService blockMQService;

    //    @Scheduled(cron = "*/5 * * * * ?")
    public void hello() throws InterruptedException {
        log.info("getting message...");
        String message = blockMQService.getMessageWithBlock();
        log.info("get message:{}", message);
    }
}
